package business.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Required;
import org.springframework.transaction.annotation.Transactional;

import vo.TopicSource;
import business.TopicSourceService;
import dao.TopicSourceDAO;

public class TopicSourceServiceImpl implements TopicSourceService{

	private TopicSourceDAO topicSourceDao;
	
	public List<TopicSource> getAllTopicSources() {
		return topicSourceDao.findAll();
	}
	
	public List<TopicSource> getByTopicId(long topicId) {
		return topicSourceDao.findByTopicId(topicId);
	}

	@Required
	public void setTopicSourceDao(TopicSourceDAO topicSourceDao) {
		this.topicSourceDao = topicSourceDao;
	}

	@Transactional
	public void addTopicSource(TopicSource ts) {
		topicSourceDao.create(ts);
	}

	@Transactional
	public void update(TopicSource ts) {
		topicSourceDao.update(ts);
	}
	
}